/****************************************************
 * 创建人:   robin
 * 创建时间: 2023/8/30.030 14:13
 * 项目名称: cpy
 * 文件名称: ServerPortEnum.java
 * 文件描述: 
 *
 * All rights Reserved, Designed By 德品软件
 * @Copyright:2023-2023
 *
 ********************************************************/

package com.dp.enumeration;

public enum ServerPortEnum {
    PORT_NOZZLE_1(17001, ServerTypeEnum.NOZZLE, "加油枪1服务端口"),
    PORT_NOZZLE_2(17002, ServerTypeEnum.NOZZLE, "加油枪2服务端口"),
    PORT_NOZZLE_3(17003, ServerTypeEnum.NOZZLE, "加油枪3服务端口"),
    PORT_NOZZLE_4(17004, ServerTypeEnum.NOZZLE, "加油枪4服务端口"),
    PORT_OIL_TANK(17005, ServerTypeEnum.OIL_TANK, "油罐服务端口"),
    ;
    
    ServerPortEnum(Integer code, ServerTypeEnum type, String name) {
        this.code = code;
        this.type = type;
        this.name = name;
    }
    
    public Integer getCode() {
        return code;
    }
    
    public ServerTypeEnum getType() {
        return type;
    }
    
    public String getName() {
        return name;
    }
    
    public static ServerPortEnum codeToEnum(Integer code) {
        for (ServerPortEnum enumType : ServerPortEnum.values()) {
            if (enumType.getCode().equals(code)) {
                return enumType;
            }
        }
        return null;
    }
    
    private Integer code;
    private ServerTypeEnum type;
    private String name;
}
